package models.mappers;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import models.LevelModelPrice;
import models.LevelModelPrice;
import vos.LevelModelPriceSearchVo;
import vos.LevelModelPriceSearchVo;
import vos.LevelModelPriceVo;

public interface LevelModelPriceMapper {
	/**
	 * 统计返款设置
	 *
	 * @Title: countLevelModelPrice 
	 * @return
	 * @return: long
	 */
	long countLevelModelPrice();
	/**
	 * 获取返款设置列表
	 *
	 * @Title: listLevelModelPrice 
	 * @param vo
	 * @return
	 * @return: List<RegionVo>
	 */
	List<LevelModelPrice> listLevelModelPrice(LevelModelPriceSearchVo vo);
	/**
	 * 批量删除返款设置
	 *
	 * @Title: betchDel 
	 * @param map
	 * @return: void
	 */
	void betchDel(Map<String, List<Map<String, String>>> map);
	/**
	 * 根据id删除返款设置
	 *
	 * @Title: delLevelModelPrice 
	 * @param id
	 * @return: void
	 */
	@Delete("delete from "
			+ LevelModelPrice.TABLE_NAME
			+" where levelid=#{id} and modelid=#{modelid}")
	void delLevelModelPrice(@Param("id")Long id,@Param("modelid")String modelid);
	/**
	 * 根据id获取返款设置信息
	 * @param modelid 
	 *
	 * @Title: getById 
	 * @param levelid 返款设置id
	 * @return
	 * @return: LevelModelPrice
	 */
	@Select("select * from level_model_price_view"
			+" where levelid=#{id} and modelid=#{modelid}")
	LevelModelPriceVo getById(@Param("id")Long id, @Param("modelid")String modelid);
	/**
	 * 保存返款设置信息
	 *
	 * @Title: saveLevelModelPrice 
	 * @param device
	 * @return: void
	 */
	@Insert("insert into "
			+ LevelModelPrice.TABLE_NAME
			+" (levelid,modelid,price,createtime,createname,remark) values"
			+ "(#{levelid},#{modelid},#{price},#{createtime},#{createname},#{remark})")
	void saveLevelModelPrice(LevelModelPrice levelmodelprice);
	/**
	 * 更新返款设置信息
	 *
	 * @Title: updateLevelModelPrice 
	 * @param device
	 * @return: void
	 */
	@Update("update "
			+ LevelModelPrice.TABLE_NAME
			+" set price=#{price},remark=#{remark},modifytime=#{modifytime},modifyname=#{modifyname}"
			+ " where levelid=#{levelid} and modelid=#{modelid}")
	void updateLevelModelPrice(LevelModelPrice levelmodelprice);
	/**
	 * 导出为excel
	 *
	 * @Title: exportXls 
	 * @param vo
	 * @return
	 * @return: List<LevelModelPrice>
	 */
	List<LevelModelPriceVo> exportXls(LevelModelPriceSearchVo vo);
	/**
	 * 根据城市等级编号统计返款设置
	 *
	 * @Title: getByLevel 
	 * @param id
	 * @return
	 * @return: long
	 */
	@Select("select * from "
			+ LevelModelPrice.TABLE_NAME
			+" where levelid=#{id} limit 1")
	LevelModelPrice getByLevel(String id);
}
